import request from '@/utils/request'
import MODULE from '@/utils/module'

export function getList(data, currentPage, pageSize) {
    return request({
        //url: '/Merchant/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        url: MODULE.MODULE.merchant +'/Merchant/list?pageSize=' + pageSize + '&pageNum=' + currentPage,

        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function doDelete(id) {
    return request({
       // url:  MODULE.MODULE.merchant +'/Merchant/remove',
        url:  MODULE.MODULE.merchant +'/Merchant/remove',

        method: 'delete',
        params: { id }
    })
}

// 编辑
export function doEdit(data) {
    return request({
        url: MODULE.MODULE.merchant + '/Merchant/edit',

        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function queryForList(data) {
    return request({
        url: MODULE.MODULE.merchant +'/Merchant/query-for-list',
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



export function getUserList(data, currentPage, pageSize) {
  return request({
    url: MODULE.MODULE.user + '/User/list?pageSize=' + 50 + '&pageNum=' + 1,
    method: 'post',
    params: {},
    data: data,
    transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
      data = JSON.stringify(data)
      return data
    }],
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}


// 合利宝进件
export function doEntrySubmit(data, organId, merchantId) {
    return request({
        //url: MODULE.MODULE.merchant + '/Merchant/edit',
        url: MODULE.MODULE.merchant + '/Merchant/entryResult/' + organId + '/' + merchantId,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


// 合利宝上传资质文件
export function doUploadCredential(data, organId, merchantId) {
    return request({
        //url: MODULE.MODULE.merchant + '/Merchant/edit',
        url: MODULE.MODULE.merchant + '/Merchant/uploadCredential/' + organId + '/' + merchantId,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



// 合利宝进件 产品开通
export function doSetupProduct(data, organId, merchantId) {
    return request({
        //url: MODULE.MODULE.merchant + '/Merchant/edit',
        url: MODULE.MODULE.merchant + '/Merchant/setupProduct/' + organId + '/' + merchantId,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



// 合利宝进件 微信报备
export function doWechatApply(data, organId, merchantId) {
    return request({
        //url: MODULE.MODULE.merchant + '/Merchant/edit',
        url: MODULE.MODULE.merchant + '/Merchant/wechatApply/' + organId + '/' + merchantId,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



// 合利宝进件 app报备
export function doAppApply(data, organId, merchantId) {
    return request({
        //url: MODULE.MODULE.merchant + '/Merchant/edit',
        url: MODULE.MODULE.merchant + '/Merchant/appApply/' + organId + '/' + merchantId,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

// 根据参数查询
export function doQueryBy(data) {
    return request({
        //url: MODULE.MODULE.merchant + '/Merchant/edit',
        url: MODULE.MODULE.merchant + '/Merchant/queryBy',
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}






